package com.loong.factory;

public class Main {
    public static void main(String[] args) {
        String path = "C:/程序设计/Java/SpringHomework/logger_factory/logs";
        LoggerFactory loggerFactory = new FileLoggerFactory();
        Logger logger = loggerFactory.createLogger();
        logger.setFilePath(path);
        logger.setLevel("DEBUG");
        for (int i = 0; i < 100; i++) {
            logger.log("This is a log message."+i);
        }

        loggerFactory = new DatabaseLoggerFactory();
        logger = loggerFactory.createLogger();
        logger.setFilePath(path);
        logger.setLevel("INFO");
        for (int i = 0; i < 100; i++) {
            logger.log("This is a log message."+i);
        }

        loggerFactory = new EventLoggerFactory();
        logger = loggerFactory.createLogger();
        logger.setFilePath(path);
        logger.setLevel("WARNING");











        for (int i = 0; i < 100; i++) {
            logger.log("This is a log message."+i);
        }
        System.out.println("日志记录完成。请检查日志文件。");
    }
}
